﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;

namespace bomberbide
{
    public class bomber
    {
        #region Properties
        private joueur _Joueur;
        public joueur Joueur
        {
            get { return _Joueur; }
            set { _Joueur = value; }
        }
        
        private ContentManager _Content;
        public ContentManager Content
        {
            get { return _Content; }
            set { _Content = value; }
        }
        
        private Random _Randomer;
        public Random Randomer
        {
            get { return _Randomer; }
            set { _Randomer = value; }
        }
        
        private int _Stock;
        public int Stock
        {
            get { return _Stock; }
            set { _Stock = value; }
        }

        private int _Score;
        public int Score
        {
            get { return _Score; }
            set { _Score = value; }
        }

        private int _PuissanceBombe;
        public int PuissanceBombe
        {
            get { return _PuissanceBombe; }
            set { _PuissanceBombe = value; }
        }

        private int _MaxBombe;
        public int MaxBombe
        {
            get { return _MaxBombe; }
            set { _MaxBombe = value; }
        }

        private string _Pseudo;
        public string Pseudo
        {
            get { return _Pseudo; }
            set { _Pseudo = value; }
        }

        private bool _Remote;
        public bool Remote
        {
            get { return _Remote; }
            set { _Remote = value; }
        }

        private bool _Kick;
        public bool Kick
        {
            get { return _Kick; }
            set { _Kick = value; }
        }

        private double _Speed;
        public double Speed
        {
            get { return _Speed; }
            set { _Speed = value; }
        }

        private layMode _LayMode;
        public layMode LayMode
        {
            get { return _LayMode; }
            set { _LayMode = value; }
        }

        private bool _Invisible;
        public bool Invisible
        {
            get { return _Invisible; }
            set { _Invisible = value; }
        }

        private List<buff> _Buffs;
        public List<buff> Buffs
        {
            get { return _Buffs; }
            set { _Buffs = value; }
        }

        private bombe _LastBomb;
        public bombe LastBomb
        {
            get { return _LastBomb; }
            set { _LastBomb = value; }
        }
        
        
        #endregion
        public void Update(GameTime gameTime)
        {
            List<buff> toDelete = new List<buff>();
            foreach (var item in this.Buffs)
            {
                if (item.Mort < gameTime.TotalGameTime.TotalMilliseconds)
                {
                    item.Rollback(this);
                    toDelete.Add(item);
                }
            }
            foreach (var item_ in toDelete)
                this._Buffs.Remove(item_);
        }
        #region Contructeurs
        public bomber(ContentManager Content)
        {
            this.LastBomb = null;
            this.Content = Content;
            this.Randomer = new Random();
            this.LayMode = layMode.normal;
            this.Buffs = new List<buff>();
            this.PuissanceBombe = 2;
            this.Stock = 5;
            this.Pseudo = "Grosse Vache";
            this.Kick = false;
            this.Invisible = false;
            this.MaxBombe = 1;
            this.Remote = false;
            this.Speed = 2;
            this.Joueur = new joueur(this.Content);
            this.Joueur.Position = new Vector2(64, 64);
        }
        #endregion
        #region Enums
        public enum layMode
        {
            normal, random, continuous, forbidden
        }
        #endregion
    }
}
 